<!DOCTYPE HTML>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" />
<title>Admin Login</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/static/admin/font/iconfont/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/plugins/Bootstrap/5.0.1/css/bootstrap.css" />
<style>
body {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  padding-top: 40px;
}
* {
  outline: none;
}
form {
  width: 100%;
  max-width: 330px;
  padding: 15px;
  margin: auto;
}
.verification-code {
  margin-left: 5px;
  width: 100px;
  height: 38px;
}
.foot {
  color: #999;
  font-size: .85rem;
}
</style>
</head>
<body class="bg-light">
<form class="text-center" id="form" action="/admin/login" method="post">
  @csrf
  <h3 class="mb-4">后台登录</h3>
  <input type="text" name="username" class="form-control mb-2" placeholder="用户名">
  <input type="password" name="password" class="form-control" placeholder="密码">
  <div class="d-grid gap-2 mt-4">
    <button class="btn btn-primary" type="submit">登录</button>
  </div>
  <p class="foot mt-4">©2022</p>
</form>
<script type="text/javascript" src="/static/admin/plugins/jquery/3.3.1/jquery.js"></script>
<script type="text/javascript" src="/static/admin/plugins/Bootstrap/5.0.1/js/bootstrap.js"></script>
<script type="text/javascript" src="/static/admin/plugins/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/admin/script/common.js"></script>
<!-- form控件 可拆分为公共文件 satrt -->
<script type="text/javascript" src="/static/admin/plugins/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/static/admin/plugins/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/static/admin/plugins/jquery.validation/1.14.0/config.js"></script>
<script type="text/javascript" src="/static/admin/plugins/jquery.form.js"></script>
<script type="text/javascript">
$("#form").validate({
  submitHandler:function() {
    var load = layer.load();
    $("#form").ajaxSubmit(function(res) {
      layer.close(load);
      if (res.code == 200) {
        layer.msg('登录成功...', {time: 1500}, function() {window.location.href = '/admin'});
      } else if (res.code == 400) {
        layer.msg(res.message);
      } else {
        layer.msg('登录失败');
      }
    });
  }
});
</script>
</body>
</html>